import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import monkey, { cdn } from 'vite-plugin-monkey';
import { version } from './package.json';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    monkey({
      entry: 'src/main.js',
      userscript: {
        icon: 'https://suda.jingxiang.ltd/_media/favicon.ico',
        namespace: ' https://suda.jingxiang.ltd',
        match: ['https://*.webtrn.cn/*'],
        name: '苏大成教助手',
        grant: 'none',
        author: 'tlxiaoyun'
      },
      build: {
        fileName: 'suda-helper-v' + version + '.user.js',
        externalGlobals: {
          vue: cdn.bootcdn('Vue', 'vue.global.prod.js'),
          // 'element-plus': cdn.bootcdn('ElementPlus', 'index.full.min.js'),
        },
      },
    }),
  ],
  build: {
    minify: true,
    outDir: 'docs/dist'
  }
});
